package com.lx.controller;

import com.lx.entity.User;
import com.lx.service.ParmaryUserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试不同数据源控制器
 *
 * @author 段誉
 * @create 2019-04-12 16:29
 */
@RestController
public class DataController {
  @Autowired
  private ParmaryUserService parmaryUserService;

  @GetMapping("/{type}")
  public User login(@PathVariable("type") Integer type) {
    switch (type) {
      case 1:
        return parmaryUserService.selDefault();
      case 2:
        return parmaryUserService.selProd();
      case 3:
        return parmaryUserService.selLocal();
      default:
        return parmaryUserService.selDefault();
    }
  }
}
